//
//  anquanwebViewController.m
//  tongxiangOASystem
//
//  Created by michael on 2018/5/11.
//  Copyright © 2018年 czd. All rights reserved.
//

#import "anquanwebViewController.h"
#import "OALoginViewController.h"
#import "GSKeyChainDataManager.h"

@interface anquanwebViewController ()

@end

@implementation anquanwebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
      NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:

[UIColor blackColor],NSForegroundColorAttributeName, nil];
 
[self.navigationController.navigationBar setTitleTextAttributes:attributes];
self.title = @"协同隐私政策";
 self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
 
 self.view.backgroundColor = [UIColor whiteColor];
   UIBarButtonItem * rightItem1  = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"箭头-左"] style:UIBarButtonItemStylePlain target:self action:@selector(createNewSMSAction)];

//[self.navigationItem setLeftBarButtonItems:@[rightItem1,rightItem2]];
[self.navigationItem setLeftBarButtonItems:@[rightItem1]];



 _webview.backgroundColor = [UIColor whiteColor];
    _webview = [[UIWebView alloc]initWithFrame:CGRectMake(0,0, KScreenWidth, KScreenHeight-kTopHeight-LL_TabbarSafeBottomMargin-40)];
      _webview.delegate=self;
        _webview.scrollView.bounces = NO;
_url = @"https://www.baidu.com";
      _webview.scalesPageToFit = YES;
    
      NSURL *url = [[NSBundle mainBundle] URLForResource:@"MyHtml" withExtension:@"html"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webview loadRequest:request];

      [self.view addSubview:_webview];
//       NSURL *urlstr = [NSURL URLWithString:_url];
//        NSURLRequest *request = [NSURLRequest requestWithURL:urlstr];
//    
//    // 3. 发送请求给服务器
//    [self.webview loadRequest:request];
    UIView *bgview = [[UIView alloc]initWithFrame:CGRectMake(0, _webview.bottom, KScreenWidth, 40)];
    bgview.backgroundColor = [UIColor colorWithWhite:.9 alpha:1];
    [self.view addSubview:bgview];
    UIColor *bgcolor = self.view.tintColor;

    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
[button1 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[button1 setTitle:@"不同意" forState:UIControlStateNormal];
button1.titleLabel.font = [UIFont systemFontOfSize: 13.0];

button1.frame = CGRectMake(10, 0, 80,40);
[button1 addTarget:self action:@selector(pushaction1) forControlEvents:UIControlEventTouchUpInside];
[bgview addSubview:button1];

UIButton *button2 = [UIButton buttonWithType:UIButtonTypeCustom];
[button2 setTitleColor:bgcolor forState:UIControlStateNormal];
[button2 setTitle:@"同意" forState:UIControlStateNormal];
button2.titleLabel.font = [UIFont systemFontOfSize: 13.0];

button2.frame = CGRectMake(bgview.width-80, 0,70, 40);
[button2 addTarget:self action:@selector(pushaction2) forControlEvents:UIControlEventTouchUpInside];
[bgview addSubview:button2];

}
- (void)pushaction2{
      UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"firstsave"];

  OALoginViewController * loginVC = [storyBoard instantiateViewControllerWithIdentifier:@"LoginVC"];
        UINavigationController * navVC = [[UINavigationController alloc]initWithRootViewController:loginVC];
                 self.view.window.rootViewController = navVC;

        loginVC.navigationController.navigationBar.hidden = YES;

}
- (void)pushaction1{
      UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

  OALoginViewController * loginVC = [storyBoard instantiateViewControllerWithIdentifier:@"LoginVC"];
        UINavigationController * navVC = [[UINavigationController alloc]initWithRootViewController:loginVC];
                 self.view.window.rootViewController = navVC;

        loginVC.navigationController.navigationBar.hidden = YES;

}
-(void)createNewSMSAction{
      UIStoryboard * storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

  OALoginViewController * loginVC = [storyBoard instantiateViewControllerWithIdentifier:@"LoginVC"];
        UINavigationController * navVC = [[UINavigationController alloc]initWithRootViewController:loginVC];
                 self.view.window.rootViewController = navVC;

        loginVC.navigationController.navigationBar.hidden = YES;

}
-(void)viewWillAppear:(BOOL)animated{

[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;

}

-(void)viewWillDisappear:(BOOL)animated

{

[super viewWillDisappear:animated];

[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
